class CreateMenus < ActiveRecord::Migration[5.2]
  def change
    create_table :menus do |t|
      t.string :name, null: false
      t.bigint :parent_id, null: false
      t.integer :kind, null: false, default: 0, comment: "类型"
      t.string :icon
      t.integer :display_order, default: 0
      t.string :target, comment: "打开方式._blank新窗口,_self本窗口"
      t.integer :is_absolute_url
      t.string :url
      t.string :module
      t.string :controller
      t.string :action
      t.integer :is_display, null: false, default: 1
      t.timestamps
    end
    # remove_column :permissions,:menu_id


    add_foreign_key :menus, :menus, column: :parent_id
    add_reference :permissions, :menus, foreign_key: true

  end
end
